public class Singelton05 {

    private static volatile Singelton05 singelton;

    private Singelton05() {
    }

    public static Singelton05 getInstance() {
        if (singelton == null) {
            synchronized (Singelton05.class) {
                if (singelton == null) {
                    singelton = new Singelton05();
                }
            }
        }
        return singelton;
    }

    public static void main(String[] args) {
        Singelton05 singelton1 = Singelton05.getInstance();
        Singelton05 singelton2 = Singelton05.getInstance();
        System.out.println(singelton1 == singelton2);
    }
}
